package com.zz.framework.core.ext

import java.math.BigDecimal
import java.text.DecimalFormat

/**
 * Copyright © 2024 zhun All rights reserved.
 * Created by Zha0Zhun on 2024/7/23 17:49.
 * @author: Zha0Zhun 1820022519@qq.com
 * @version: V1.0
 */

fun BigDecimal?.format(pattern: String = "0.00"): String {
    if (this == null) return "0"
    val fmt = DecimalFormat(pattern)
    return fmt.format(this)
}

fun BigDecimal?.toPlainString(): String {
    if (this == null) return "0"
    return this.toPlainString()
}